package SingletonDemo.exp2;

/**
 * @author zsh
 * @Description
 * @create 2022-05-13 19:44
 */
public class TripleDemo {
    private static TripleDemo tripleDemo1 = new TripleDemo();
    private static TripleDemo tripleDemo2 = new TripleDemo();
    private static TripleDemo tripleDemo3 = new TripleDemo();
    private TripleDemo(){
        System.out.println("生成实例");
    }

    public static TripleDemo getInstance(int id){
        switch (id){
            case 2:
                return tripleDemo2;
            case 3:
                return tripleDemo3;
            case 1:
            default:
                return tripleDemo1;
        }


    }
}
